<%@ page language="java" %>

<%@ page import="java.util.ArrayList,
                 com.scalar.chiptrack.commons.SessionKeys,
                 com.scalar.chiptrack.utils.ConfigManager,
				 com.scalar.chiptrack.commons.Constants,
				 com.scalar.chiptrack.users.Functionality,
				 com.scalar.chiptrack.users.User,
				 com.scalar.chiptrack.operations.assemblyrelease.AssemblyRelease,
                 com.scalar.chiptrack.operations.assemblyrelease.forms.AssemblyReleaseForm"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<chiptrack:checkLogon sourcePage="/assemblyRelease.do" />
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();
%>
<HTML>
<HEAD><TITLE>Scalarsoft - ChipTrac </TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet"></HEAD>
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/assembly_release.js"></script>

<style>
<!--
.HEADING     { cursor: hand; font-family: Verdana; font-size: 8pt; color: #000000;
               background-color: #FFFFFFF; font-weight: bold;
               border: 0 solid #000000  COLOR: #000000;}
-->
</style>

<SCRIPT language="JavaScript">
	var focusNum = 0;
	var dateElement = "";

    function sendMail()
    {
        var productId=document.assemblyReleaseForm.productId.value;
        var processStepId=document.assemblyReleaseForm.processStepId.value;
        var fromLocationId=document.assemblyReleaseForm.fromLocationId.value;
        var assemblyReleaseId=document.assemblyReleaseForm.assemblyReleaseId.value;
        var toLocationId=document.assemblyReleaseForm.locationId.value;
        //var findex=toLocationId.indexOf('/');
        //var toLocationId1=toLocationId.substring(0,findex);
	    window.open ('<%=chipTracContext%>/sendAssemblyMail.do?productId='+productId+'&processStepId='+processStepId+'&fromLocationId='+fromLocationId+'&assemblyReleaseId='+assemblyReleaseId+'&toLocationId='+toLocationId, 'sendMailPopup1','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=800,height=550,resizable=yes');
    }
</SCRIPT>

<BODY bgColor="#ffffff" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0" >
<TABLE cellSpacing=0 cellPadding=0 width="100%" border="0" align="center">
    <TR>
        <TD bgcolor="#ffffff"><IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
        <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
        <TD valign="top" width="100%">
            <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
            <BR>
            <html:form action="/assemblyRelease" method="POST" >
            <% int i = 10; %>
            <%
                ArrayList assemblyBuildArrayList = ( ArrayList ) request.getAttribute("assemblyReleaseDetails");
                AssemblyRelease assemblyRelease = ( AssemblyRelease ) assemblyBuildArrayList.get(0);
            %>
            <TABLE width="100%" align="right" cellpadding="2" cellspacing="2" border="0">
                <TR>
                    <TD>
                        <TABLE width="100%" align="right" cellpadding="0" cellspacing="0" border="0">
                            <TR>
                                <TD width="25%" align="left">
                                    <img src="<%=chipTracContext%>/jsp/includes/images/scalar_logo.jpg" height="84" width="200" border=0>
                                </TD>
                                <TD width="45%" align="center" class="NArialW" >
                                    <b>Assembly Build Instructions</b>
                                    <br>
                                    <font class="NArialL">
                                        <bean:write name="clientName" filter="false" />
                                        <br>
                                        <bean:write name="assemblyReleaseClientAddress" filter="false" />
                                    </font>
                                </TD>
                                <TD width="5%" valign="center">
                                    <a href="javascript:window.print();" title='Click to Print Assembly Release Instructions'><img height="80" width="60" src="<%=chipTracContext%>/jsp/includes/images/printer_icon_small.gif" border="0"></a>
                                </TD>
                                <TD width="15%" valign="center">
                                    <a href="javascript:sendMail();" title='Click to Mail Assembly Release Instructions'><img src="<%=chipTracContext%>/jsp/includes/images/email1.gif" border="0"></a>
                                </TD>
                            </TR>
                        </TABLE>
                    </TD>
                </TR>
                <TR><TD align="left" class='NArialL'>&nbsp;<FONT id="errors" color='FF0000'></font></TD></TR>
                <TR><TD>&nbsp;<chiptrack:errors styleClass="NArialL"/><br><chiptrack:info styleClass="NArialL"/> </TD></TR>
                <TR>
                    <TD>
                    <logic:equal name="assemblyReleaseForm" property="assemblyReleaseStatus" value="Cancelled"><!--Added by Suresh Yeruva on [ 10 AUG 2004 ].-->
                        <TABLE width="100%" align="right" cellpadding="0" cellspacing="0" border="0" background="<%=chipTracContext%>/jsp/includes/images/cancelled_icon.gif">
                    </logic:equal>
                    <logic:notEqual name="assemblyReleaseForm" property="assemblyReleaseStatus" value="Cancelled"><!--Added by Suresh Yeruva on [ 10 AUG 2004 ].-->
                        <TABLE width="100%" align="right" cellpadding="0" cellspacing="0" border="0">
                    </logic:notEqual>
                            <TR>
                                <TD width="45%" valign="top">
                                    <table width="100%" class="NArialRS" border='1' bordercolor='#000000' cellspacing='0' bgcolor='#FFFFEE'>
                                        <tr height=30>
                                            <td  colspan="2" align="center" class="NArialR" bgcolor="#DEE1E2" >&nbsp;Wafer Lot Information</td>
                                        </tr>
                                        <tr><td colspan="2">&nbsp;</td></tr>
                                        <tr>
                                            <td width="50%" align="left" class="NArialR">&nbsp;Assembly Device Name</td>
                                            <td width="50%" align="left" class="NArialR">&nbsp;<bean:write name="assemblyReleaseForm" property="deviceName" /></td>
                                        </tr>

                                        <tr>
                                            <td align="left" class="NArialR">&nbsp;Base Product</td>
                                            <td width="50%" align="left" class="NArialR">&nbsp;<%=assemblyRelease.getAssemblyBaseProductPDF ()%></td>
                                        </tr>

                                        <tr>
                                            <td align="left" class="NArialR">&nbsp;PO Number</td>
                                            <td width="50%" align="left" class="NArialR">&nbsp;<bean:write name="assemblyReleaseForm" property="poNumber" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left" class="NArialR">&nbsp;Release Date</td>
                                            <td width="50%" align="left" class="NArialR">&nbsp;<bean:write name="assemblyReleaseForm" property="releaseDate" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left" class="NArialR">&nbsp;Ship From Location</td>
                                            <td width="50%" align="left" class="NArialR" nowrap>
                                            <logic:iterate id="assRealease" name="assemblyReleaseDetails" type="com.scalar.chiptrack.operations.assemblyrelease.AssemblyRelease" >
                                                &nbsp;<bean:write name="assRealease" property="assemblyShipFromPDF" />
                                                <br>
                                            </logic:iterate>
                                            </td>
                                        </tr>
                                    </table>
                                </TD>
                                <TD >&nbsp;</TD>
                                <TD width="50%" valign="top">
                                    <table width="100%" class="NArialRS" border='1' bordercolor='#000000' cellspacing='0' bgcolor='#FFFFEE'>
                                        <tr height=30>
                                            <td  colspan="2" align="center" class="NArialR" bgcolor="#DEE1E2" >Laser Information</td>
                                        </tr>
                                        <tr><td colspan="2">&nbsp;</td></tr>
                                        <tr>
                                            <td width="50%" align="left" class="NArialR">&nbsp;Fuse File Location</td>
                                            <td width="50%" align="center" class="NArialR">&nbsp;
                                                <bean:write name="assemblyReleaseForm" property="fuseFileLocation" />
                                            </td>
                                        </tr>

                                        <tr>
                                            <td align="left" class="NArialR">&nbsp;Wafer Map Location</td>
                                            <td width="50%" align="center" class="NArialR">&nbsp;
                                                <bean:write name="assemblyReleaseForm" property="waferMapLocation" />
                                            </td>
                                        </tr>
                                    </table>
                                </TD>
                            </TR>
                            <TR><TD colspan="3" >&nbsp;</TD></TR>
                            <TR>
                                <TD width="45%" valign="top">
                                    <table width="100%" class="NArialRS" border='1' bordercolor='#000000' cellspacing='0' bgcolor='#FFFFEE'>
                                        <tr height=30>
                                            <td align="center" class="NArialR" bgcolor="#DEE1E2" >Lot Number</td>
                                            <td align="center" class="NArialR" bgcolor="#DEE1E2" >Wafer Id</td>
                                            <td align="center" class="NArialR" bgcolor="#DEE1E2" >Quantity<% long totQty=0;  %></td>
                                        </tr>

                                        <logic:iterate id="assReleaseLotList" name="assemblyReleaseLotList" type="com.scalar.chiptrack.operations.assemblyrelease.AssemblyRelease">
                                           <tr bgcolor='#FFFFEE'>
                                                <td align="left"  class="NArialR">&nbsp;<bean:write name="assReleaseLotList" property="assemblyLotNumberPDF" /></td>
                                                <td align="right" class="NArialR">&nbsp;<bean:write name="assReleaseLotList" property="assemblyWaferIdPDF" />&nbsp;&nbsp;</td>
                                                <bean:define id="waferQty" name="assReleaseLotList" property="assemblyWaferQuantityPDF" />
                                                <bean:define id="dieQty" name="assReleaseLotList" property="assemblyDieQuantityPDF" />
                                                <bean:define id="grossQty" name="assReleaseLotList" property="assemblyGrossDiePerWaferPDF" />
                                                <% if (assReleaseLotList.getAssemblyDieQuantityPDF().equals("0")) { %>
                                                <td align="right" class="NArialR">&nbsp;<%= ( Long.parseLong( waferQty.toString() ) * Long.parseLong( grossQty.toString() ) ) %>&nbsp;&nbsp;</td>
                                                <% }else{  %>
                                                <td align="right" class="NArialR">&nbsp;<%= Long.parseLong( dieQty.toString() ) %>&nbsp;&nbsp;</td>
                                                <% } %>
                                                <% totQty = totQty + ( ( Long.parseLong( waferQty.toString() ) * Long.parseLong( grossQty.toString() )) + Long.parseLong( dieQty.toString() ) ); %>
                                            </tr>
                                        </logic:iterate>
                                        <tr bgcolor='#FFFFEE'>
                                            <td colspan="2" align="right" class="NArialR">Total Quantity&nbsp;&nbsp;</td>
                                            <td colspan="2" align="right" class="NArialR"><%=totQty%>&nbsp;&nbsp;</td>
                                        </tr>
                                    </table>
                                </TD>
                                <TD width="5%">&nbsp;</TD>
                                <TD width="50%" valign="top">
                                    <table width="100%" class="NArialRS" border='1' bordercolor='#000000' cellspacing='0'   bgcolor='#FFFFEE'>
                                        <tr height=30>
                                            <td colspan="2" align="center" class="NArialR" bgcolor="#DEE1E2" bgcolor='#FFFFEE'>Assembly Information</td>
                                        </tr>
                                        <tr><td colspan="2">&nbsp;</td></tr>
                                        <tr>
                                            <td width="50%" align="left" class="NArialR">&nbsp;Package</td>
                                            <td width="50%" align="center" class="NArialR">&nbsp;
                                               <bean:write name="assemblyReleaseForm" property="packaze" />
                                            </td>
                                        </tr>

                                        <tr>
                                            <td align="left" class="NArialR">&nbsp;QTY to Build</td>
                                            <td width="50%" align="center" class="NArialR">&nbsp;
                                                <%=totQty%>
                                            </td>
                                        </tr>
                                        <tr><td colspan="2">&nbsp;</td></tr>
                                        <tr>
                                            <td align="left" class="NArialR">&nbsp;Bonding Diagram</td>
                                            <td width="50%" align="center" class="NArialR">&nbsp;
                                                 <bean:write name="assemblyReleaseForm" property="bondingDiagram" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left" class="NArialR">&nbsp;PN Marking</td>
                                            <td width="50%" align="center" class="NArialR">&nbsp;
                                                 <bean:write name="assemblyReleaseForm" property="pnMarking" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left" class="NArialR">&nbsp;Category</td>
                                            <td width="50%" align="center" class="NArialR">&nbsp;
                                                 <bean:write name="assemblyReleaseForm" property="category" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left" class="NArialR">&nbsp;Line-1</td>
                                            <td width="50%" align="center" class="NArialR">&nbsp;
                                               <bean:write name="assemblyReleaseForm" property="line1" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left" class="NArialR">&nbsp;Line-2</td>
                                           <td width="50%" align="center" class="NArialR">&nbsp;
                                                <bean:write name="assemblyReleaseForm" property="line2" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left" class="NArialR">&nbsp;Line-3</td>
                                            <td width="50%" align="center" class="NArialR">&nbsp;
                                                <bean:write name="assemblyReleaseForm" property="line3" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left" class="NArialR">&nbsp;Line-4</td>
                                            <td width="50%" align="center" class="NArialR">&nbsp;
                                                <bean:write name="assemblyReleaseForm" property="line4" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left" class="NArialR">&nbsp;Line-5</td>
                                            <td width="50%" align="center" class="NArialR">&nbsp;
                                                <bean:write name="assemblyReleaseForm" property="line5" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left" class="NArialR">&nbsp;Line-6</td>
                                            <td width="50%" align="center" class="NArialR">&nbsp;
                                                <bean:write name="assemblyReleaseForm" property="line6" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left" class="NArialR">&nbsp;Build Instruction</td>
                                            <td width="50%" align="center" class="NArialR">&nbsp;
                                                 <bean:write name="assemblyReleaseForm" property="buildInstruction" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left" class="NArialR">&nbsp;Special Instructions</td>
                                            <td width="50%" align="center" class="NArialR">&nbsp;
                                                 <bean:write name="assemblyReleaseForm" property="specialInstruction" />
                                            </td>
                                        </tr>
                                    </table>
                                </TD>
                            </TR>
                            <TR><TD colspan="3">&nbsp;</TD></TR>
                            <TR>
                                <TD width="45%">&nbsp;</TD>
                                <TD width="5%">&nbsp;</TD>
                                <TD width="50%" valign="top">
                                    <table width="100%" class="NArialRS" border='1' bordercolor='#000000' cellspacing='0' bgcolor='#FFFFEE'>
                                        <tr height=30>
                                            <td  colspan="2" align="center" class="NArialR" bgcolor="#DEE1E2" >Test Information</td>
                                        </tr>
                                        <tr><td colspan="2">&nbsp;</td></tr>
                                        <tr>
                                            <td width="50%" align="left" class="NArialR">&nbsp;Mark At Assembly (MAA)</td>
                                            <td width="50%" align="center" class="NArialR">&nbsp;
                                                <bean:write name="assemblyReleaseForm" property="markAtAssembly" />
                                            </td>
                                        </tr>

                                        <tr>
                                            <td align="left" class="NArialR">&nbsp;Mark At Test (MAT)</td>
                                            <td width="50%" align="center" class="NArialR">&nbsp;
                                                <bean:write name="assemblyReleaseForm" property="markAtTest" />
                                            </td>
                                        </tr>
                                    </table>
                                </TD>
                             </TR>
                             <TR><TD colspan="3">&nbsp;</TD></TR>
                            <TR>
                                <TD width="45%">&nbsp;</TD>
                                <TD width="5%">&nbsp;</TD>
                                <TD width="50%" valign="top">
                                    <table width="100%" class="NArialRS" border='1' bordercolor='#000000' cellspacing='0'>
                                        <tr height=30>
                                            <td colspan="2" align="center" class="NArialR" bgcolor="#DEE1E2" >Shipping Information</td>
                                        </tr>
                                        <tr bgcolor='#FFFFEE'>
                                            <td width="50%" valign="top" align="left" class="NArialR">&nbsp;Ship To</td>
                                            <td width="50%" align="left" class="NArialR">
                                               <bean:write name="assemblyReleaseShipToAddress" filter="false" />
                                            </td>
                                        </tr>
                                    </table>
                                </TD>
                             </TR>
                        </TABLE>
                    </TD>
                </TR>
                <TR><TD colspan="4" width="100%"><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height="20" width="1"></TD></TR>
                <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='20'></TD></TR>
            </TABLE>
            <input type="hidden" name="action"/>

            <html:hidden name="assemblyReleaseForm" property="productId" />
            <html:hidden name="assemblyReleaseForm" property="processStepId" />
            <html:hidden name="assemblyReleaseForm" property="fromLocationId" />
            <html:hidden name="assemblyReleaseForm" property="assemblyReleaseId" />
			<html:hidden name="assemblyReleaseForm" property="locationId" />
			<html:hidden name="assemblyReleaseForm" property="assemblyReleaseStatusId" />
			<html:hidden name="assemblyReleaseForm" property="assemblyReleaseStatus" />

        </html:form>
        <!-- till here -->
        </TD>
    </TR>
</TABLE>
</BODY>
</HTML>